package com.ycx.furns.dao.impl;

import com.ycx.furns.dao.BasicDAO;
import com.ycx.furns.dao.OrderDAO;
import com.ycx.furns.entity.Order;
import com.ycx.furns.entity.OrderItem;

import java.util.List;

public class OrderDAOImpl extends BasicDAO<Order> implements OrderDAO {
    @Override
    public int saveOrder(Order order) {
        String sql = "insert into `order`(`id`, create_time,`price`, `status`, member_id) values(?, ?, ?, ?, ?)";
        return update(sql, order.getId(), order.getCreateTime(), order.getPrice(), order.getStatus(), order.getMemberId());
    }

    @Override
    public List<Order> queryOrders(int memberId) {
        String sql = "SELECT id, create_time createTime, price, `status`, member_id memberId FROM `order` WHERE member_id = ?";
        return queryMulti(sql, Order.class, memberId);
    }


}
